/*
* @Author: Adolphus.Yao
* @Date:   2019-09-04 14:37:12
* @Last Modified by:   Adolphus.Yao
* @Last Modified time: 2019-10-25 11:56:20
*/
package main

import (
    "fmt"
    "strings"
    "fulnero.com/temp/row"
    "regexp"
)

type Dst func(args ...interface{}) string

func Tame(dst Dst) {
    dst("wo", "shi", "zhong", "guo", "ren")
    fmt.Println("Tame")
}

func main() {
    r := row.Row{}
    Tame(r.DoSomeThing)
    fmt.Println("end")
    ss := "1_13_110101194610232059"
    fmt.Println(ss[5:len(ss)])
    kn := "231026******294637"
    fmt.Println(strings.Contains(kn, "*******"))
    str := `[yao]  c2   14435191   14440375   card_type:  10    622627198009211610      {"card_list":[{"card_type":3,"card_number":"6****************0","card_use_count":4,"last_use_time_sec":1552378880,"card_index":1,"create_time":1549970665},{"card_type":1,"card_number":"6****************0","city_code":"440300","card_use_count":1,"last_use_time_sec":1552378503,"card_index":2,"create_time":1550535768},{"card_type":11,"card_number":"J441621-2015-005016","card_use_count":2,"last_use_time_sec":1552405643,"card_index":3,"create_time":1552378933},{"card_type":10,"card_number":"Q********2","plate_number":"Q441212202","card_use_count":3,"last_use_time_sec":1552405726,"card_index":4,"license_code":"4400002018000VP5F4","extra":"Q441212202","create_time":1552379094},{"card_type":10,"card_number":"Q441212202","plate_number":"Q441212202","last_use_time_sec":1552405524,"card_index":5,"license_code":"4400002018000VP5F4","create_time":1552405524}],"bind_card_sort":[3,1,11],"not_exist":true}"`
    re := regexp.MustCompile("\\s+")
    str = re.ReplaceAllString(str, " ")
    strs := strings.Split(str, " ")
    // for i := 0; i < len(strs); i++ {
    //     fmt.Println(strs[i])
    // }
    fmt.Printf("%d****%s****\n", len(strs), strs[5])
    str1 := `{"level":"info","app":"cardservice","ts":1571897382.027229,"goid":"(14070,3756150)","time":"2019-10-24T14:09:42.027+0800","hint":"ZRPM/rNYNw29","uid":"5d4155d6a03c25280e5c3c7c","caller":"cardservicelogic/CardServiceHandler.go:316","msg":"[yao]3 update card list number! card_type: 3, card_index: 1, before: [{\"card_type\":3,\"card_number\":\"4****************9\",\"card_use_count\":22,\"last_use_time_sec\":1569379040,\"card_index\":1,\"create_time\":1564563691},{\"card_type\":26,\"card_number\":\"440822197308313819\",\"card_use_count\":22,\"last_use_time_sec\":1569379028,\"card_index\":2,\"create_time\":1564818876}], after: [{\"card_type\":3,\"card_number\":\"440822197308313819\",\"card_use_count\":22,\"last_use_time_sec\":1569379040,\"card_index\":1,\"create_time\":1564563691},{\"card_type\":26,\"card_number\":\"440822197308313819\",\"card_use_count\":22,\"last_use_time_sec\":1569379028,\"card_index\":2,\"create_time\":1564818876}]\n"}`
    if 0 < len(str1) && strings.Contains(str1, "card_type:") {
        iIndex := strings.Index(str1, "card_type:")
        jIndex := strings.Index(str1, ", card_index:")
        if 0 < iIndex && 0 < jIndex && iIndex < jIndex {
            ls := str1[iIndex:jIndex]
            fmt.Println(strings.Replace(ls, "card_type: ", "", -1))
        } else {
            fmt.Println("Error line can not find json char!", str1, " ", 0)
        }
    } else {
        fmt.Println("Error line is invaild data!", str1, " ", 0)
    }
    it := uint32(23)
    sit := fmt.Sprintf("%d", it)
    fmt.Println(sit)
    cid := "440582******050013"
    fmt.Println(strings.Count(cid, "*"))
}
